﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using Microsoft.Windows.Design;
using Microsoft.Windows.Design.Metadata;
using XamlingCore.SL.Controls.Behavior;

[assembly: ProvideMetadata(typeof(XamlingCore.SL.Design.InteractivityMetadataStore))]

namespace XamlingCore.SL.Design
{
	/// <summary>
	/// Provides design-time metadata for all of the classes.
	/// </summary>
	public class InteractivityMetadataStore : IProvideAttributeTable {
		#region IProvideAttributeTable Members

		public AttributeTable AttributeTable {
			get {
				AttributeTableBuilder attributeTableBuilder = new AttributeTableBuilder();


                attributeTableBuilder.AddCustomAttributes(typeof(ObjectTypeSwitchBehavior), new ToolboxCategoryAttribute("Data"));
                attributeTableBuilder.AddCustomAttributes(typeof(ObjectTypeSwitchCase), "Value", new TypeConverterAttribute(typeof(DumbTypeConverter)));
                attributeTableBuilder.AddCustomAttributes(typeof(ObjectTypeSwitchBehavior), new DefaultBindingPropertyAttribute("Binding"));

				attributeTableBuilder.AddCustomAttributes(typeof(DataStateSwitchBehavior), new ToolboxCategoryAttribute("Data"));
				attributeTableBuilder.AddCustomAttributes(typeof(DataStateSwitchCase), "Value", new TypeConverterAttribute(typeof(DumbTypeConverter)));
				attributeTableBuilder.AddCustomAttributes(typeof(DataStateSwitchBehavior), new DefaultBindingPropertyAttribute("Binding"));

			

				attributeTableBuilder.AddCustomAttributes(typeof(GoToNextState), new ToolboxCategoryAttribute("Experimental"));

				attributeTableBuilder.AddCustomAttributes(typeof(GoToPreviousState), new ToolboxCategoryAttribute("Experimental"));

				


				
			}
		}

		/// <summary>
		/// Gives properties of type Object a string entry field in Blend's property editor.
		/// </summary>
		private class DumbTypeConverter : TypeConverter {
			public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
				return true;
			}

			public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
				return destinationType == typeof(object);
			}

			public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {
				return value;
			}

			public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
				return value;
			}
		}

		#endregion
	}
}
